import { Provide } from '@midwayjs/core';
import { ILoginOptions } from '../interface';

@Provide()
export class LoginService {
  async login(options: ILoginOptions) {
    const response = {
      code: 200,
      message: '登录成功',
      data: null,
    };
    if (options.phoneNum === '18717172486' && options.pwd === '123456') {
      response.code = 200;
      response.message = '登录成功';
      response.data = {
        token: 'hdakjdhgkadhka',
        phone: '18717172486',
      };
    } else {
      response.code = 10001;
      response.message = '用户名或密码输入错误';
      response.data = null;
    }
    return response;
  }
}
